package com.example.demo.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
public class AsyncService {
    private static final Logger log = LoggerFactory.getLogger(AsyncService.class);

    @Autowired
    private CommentService commentService;

    @Async
    public boolean del(Integer id) {
        try {
            // 删除评论
            return commentService.removeById(id);
        } catch (Exception e) {
            log.error("删除评论失败: {}", e.getMessage());
            return false;
        }
    }
} 